﻿using ArtMath.Attribute;
using ArtMath.Core.Data;
using ArtMath.Data;
using System;
using System.ComponentModel;
using ArtMath.PointCollection;
using System.Linq;
using ArtMath.CommonType;

namespace ArtMath.Component.Point
{
    /// <summary>
    /// 构造点基类
    /// </summary>
    [Serializable]
    public abstract class ConstructedPointBase : PointBase
    {
        public ConstructedPointBase(SketchPad pad, string name, ToolTypeName toolType, bool addToList = true) : base(pad, name, toolType, addToList)
        {

        }
        public override bool Movable
        {
            get
            {
                if (ObjectState != ObjectState.Normal) return true;
                if (OutHosts != null)
                {
                    foreach (LineBase item in OutHosts)
                    {
                        if (Pad.LineFlags.Contains(item))
                        {
                            return true;
                        }
                    }
                }
                return false;
            }
        }
        [Browsable(false)]
        public override RPointS RotateCenter
        {
            get
            {
                return base.RotateCenter;
            }

            set
            {
                base.RotateCenter = value;
            }
        }
        [Browsable(false)]
        public override AngleStringX RotateAngle
        {
            get
            {
                return base.RotateAngle;
            }

            set
            {
                base.RotateAngle = value;
            }
        }
        [MultilingualCategory("Parameter"), ReadOnly(true)]
        public override PadStringX X
        {
            get
            {
                return base.X;
            }

            set
            {
                base.X = value;
            }
        }
        [MultilingualCategory("Parameter"), ReadOnly(true)]
        public override PadStringX Y
        {
            get
            {
                return base.Y;
            }

            set
            {
                base.Y = value;
            }
        }
        //public override PointCollectionsManager GetMoveSpace(Base sender = null)
        //{
        //    return new PointCollectionsManager(new DiscontinuityPoint(GetNewLocationAfterOutHostChanged(true)));
        //}
        public override void CreateComponents()
        {
            ForceMove(GetNewLocationAfterOutHostChanged(), false);
            base.CreateComponents();
        }
    }
}
